<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <link rel="Stylesheet" type="text/css" href=
  "../../default.css" />
  <meta http-equiv="Content-Type" content=
  "text/html; charset=utf-8" />

  <title>Activation API</title>
  <style type="text/css">
/*<![CDATA[*/
                th {text-align:left;}
                table {border-collapse:collapse; margin-top: 4px;}
                td,th {border: 1px solid #B0B0B0; padding-left:10;padding-right:10;}
    /*]]>*/
  </style>
</head>

<body>
  <h1>Activation API</h1>

  <p>Activation API contains only 4 functions. Two for online activation and other two for offline activation when the computer has no access to the Internet. Activation API is intended to work in cooperation with Web License Manager, so a developer still should invoke licensing system API to use serial numbers obtained from WebLM.</p><strong id=
  "VMProtectActivateLicense">VMProtectActivateLicense</strong>

  <p>The function passes the activation code to the server and returns a serial number for this specific computer. Otherwise, an <a href="#codes">error code</a> is returned.</p>
  <pre class="code">int VMProtectActivateLicense(const char *code, char *serial, int size);
</pre>

  <p>The <strong>code</strong> parameter holds the activation code obtained from Web License Manager during the license purchase process.
  The <strong>serial</strong> parameter specifies a memory block of the given
  <strong>size</strong>, where the serial number generated by WebLM is put to.</p><strong id=
  "VMProtectDeactivateLicense">VMProtectDeactivateLicense</strong>

  <p>This function passes a serial number to the server for deactivation.
  Possible return codes are listed <a href=
  "#codes">below</a>.</p>
  <pre class="code">int VMProtectDeactivateLicense(const char *serial);
</pre>

  <p>The <strong>serial</strong> parameters contains the serial number (not the activation code) obtained from WebLM earlier during activation.</p><strong id=
  "VMProtectGetOfflineActivationString">VMProtectGetOfflineActivationString</strong><br />

  <strong id=
  "VMProtectGetOfflineDeactivationString">VMProtectGetOfflineDeactivationString</strong>

  <p>These two functions work similar to the previous two, except they do not try to connect to the WebLM server. Instead, they return a text block that a user should copy to a computer connected to the Internet, open the WebLM offline activation form and paste the text there.</p>
  <pre class="code">int VMProtectGetOfflineActivationString(const char *code, char *buf, int size);
int VMProtectGetOfflineDeactivationString(const char *serial, char *buf, int size);
</pre>

  <p>The <strong>code</strong> and <strong>serial</strong> parameters are similar to those of the online version of these functions. The 
  <strong>buf</strong> parameter should point to a buffer of 1000 bytes or more where the text block for the offline activation form will be copied to. Possible error codes are listed <a href=
  "#codes">below</a>.</p>

  <h3 id="codes">Possible error codes</h3>

  <table border="1" cellspacing="0" cellpadding="2">
    <tr>
      <th>Code</th>

      <th>Value</th>

      <th>Description</th>
    </tr>

    <tr>
      <td>ACTIVATION_OK</td>

      <td>0</td>

      <td>Activation is successful. The serial number is put to the 
      <strong>serial</strong> variable.</td>
    </tr>

    <tr>
      <td>ACTIVATION_SMALL_BUFFER</td>

      <td>1</td>

      <td>The buffer is too small to hold the serial number. The minimum buffer size is calculated as: bits / 8 * 3 / 2 + N,
      where bits is the length of the RSA key in bits, and N is a "security constant" - additional bytes for possible line breaks and other special symbols. We recommend using at least 10.</td>
    </tr>

    <tr>
      <td>ACTIVATION_NO_CONNECTION</td>

      <td>2</td>

      <td>The activation module couldn't connect to Web License
      Manager.</td>
    </tr>

    <tr>
      <td>ACTIVATION_BAD_REPLY</td>

      <td>3</td>

      <td>The activation server returned an unexpected result. This means some configuration issues on the server, wrong server URL or a hack attempt.</td>
    </tr>

    <tr>
      <td>ACTIVATION_BANNED</td>

      <td>4</td>

      <td>This activation code is banned on the server by the software vendor via the WebLM interface (for example, if the key has leaked or pirated). Not to be confused with ACTIVATION_ALREADY_USED.</td>
    </tr>

    <tr>
      <td>ACTIVATION_CORRUPTED</td>

      <td>5</td>

      <td>Something has gone completely wrong. The error is produced by the activation module self-check system and usually means a hacking attempt. If you've got this error, all further operations with serial numbers and activation are not safe.</td>
    </tr>

    <tr>
      <td>ACTIVATION_BAD_CODE</td>

      <td>6</td>

      <td>The specified code is not found in the database of the activation server. Perhaps, a user made a mistake while entering the code, so we can ask him or her to check if everything all right.</td>
    </tr>

    <tr>
      <td>ACTIVATION_ALREADY_USED</td>

      <td>7</td>

      <td>The activation counter for this code is depleted and all further activations are impossible. This doesn't mean the code is bad or banned. The code is good, but it just can't be activated any more. The user should contact the software vendor and purchase additional licenses or uninstall the software on other computer to increase the value of the activation counter on the server.</td>
    </tr>

    <tr>
      <td>ACTIVATION_SERIAL_UNKNOWN</td>

      <td>8</td>

      <td>Activation error. The given serial number is not found in the database on the server. Therefore, deactivation is impossible.</td>
    </tr>

    <tr>
      <td>ACTIVATION_EXPIRED</td>

      <td>9</td>

      <td>Activation error. Means the activation period of the code has expired.</td>
    </tr>

    <tr>
      <td>ACTIVATION_NOT_AVAILABLE</td>

      <td>10</td>

      <td>This error means activation/deactivation is unavailable.</td>
    </tr>

  </table>

  <h3>Tips and tricks</h3>

  <p>Activation API is pretty simple, so you shouldn't experience difficulties with it. Do not forget to offer a way to activate the program offline for users who have problems with the Internet. Also, don't forget, the Activation API does not save the serial number it receives and does not pass it to the licensing module - this should be done by the developer. You don't have to call Activation API on every launch of the application. You just need to call it once, get a serial number from WebLM, save it where appropriate and then use this saved copy.</p><br />
  <br />
  <br />
  <br />
  <br />
  <hr noshade="noshade" size="1" />

  <div align="center">
    © 2006-2015 Copyright VMProtect Software
  </div>
</body>
</html>
